<?php 
require_once("perficature-utils.php");
insertHeader("Prime the Cache");
$startCookie = getSubCookie('RES', 'start');
$dev = ( false !== strpos($_SERVER['REQUEST_URI'], "/dev") ? "/dev" : "" );
?>

<script>
// Override the default window.onload so we wait 8 seconds after the onload event (so the prefetch has time).
window.onload = function() {
	if ( -1 == document.location.href.indexOf("step=1") ) {
		// Give time for the prefetch to go.
		window.setTimeout('document.location="<?php echo getNextTest() ?>"', 8000);
	}
}
</script>

<p>
This page downloads some resources used in the tests.

<p>
<img src='/bin/resource.cgi?type=gif&sleep=4&t=<?php echo $startCookie ?>'>
<img src='/bin/resource.cgi?type=gif&sleep=4&cacheres302=1&redir=1&t=<?php echo $startCookie ?>'>
<iframe src="/bin/resource.cgi?redir=1&sleep=8&cache302=1&redirurl=http%3A//stevesouders.com<?php echo $dev ?>/ua/cache-redirects.php%3Ft%3D<?php echo $startCookie ?>" width=0 height=0></iframe>

<p>
<?php
// prefetch the DNS lookups
for ( $j = 1; $j <= 30; $j++ ) {
	echo "<img id=img$j src='http://$j.cuzillion.com/bin/resource.cgi?type=gif&sleep=0&t=" . time() . "'>\n";
}
?>

<link rel="prefetch" href="/bin/resource.cgi?type=gif&sleep=4&prefetch=1&t=<?php echo $startCookie ?>">
<?php insertFooter(); ?>
